home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / cursor / cursor.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  3.4 KB  |  109 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Cursor demo by Pierre Fillion"
  6.    ClientHeight    =   2400
  7.    ClientLeft      =   1395
  8.    ClientTop       =   1560
  9.    ClientWidth     =   4365
  10.    FillStyle       =   0  'Solid
  11.    Height          =   2805
  12.    Left            =   1335
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   10
  17.    ScaleMode       =   4  'Character
  18.    ScaleWidth      =   36.375
  19.    Top             =   1215
  20.    Width           =   4485
  21.    Begin PictureBox Picture2 
  22.       AutoSize        =   -1  'True
  23.       BackColor       =   &H00C0C0C0&
  24.       FillStyle       =   0  'Solid
  25.       Height          =   510
  26.       Left            =   135
  27.       Picture         =   CURSOR.FRX:0000
  28.       ScaleHeight     =   32
  29.       ScaleMode       =   3  'Pixel
  30.       ScaleWidth      =   32
  31.       TabIndex        =   5
  32.       Top             =   720
  33.       Width           =   510
  34.    End
  35.    Begin PictureBox Picture1 
  36.       AutoSize        =   -1  'True
  37.       BackColor       =   &H00C0C0C0&
  38.       FillStyle       =   0  'Solid
  39.       Height          =   510
  40.       Left            =   120
  41.       Picture         =   CURSOR.FRX:0302
  42.       ScaleHeight     =   32
  43.       ScaleMode       =   3  'Pixel
  44.       ScaleWidth      =   32
  45.       TabIndex        =   4
  46.       Top             =   120
  47.       Width           =   510
  48.    End
  49.    Begin CommandButton Command4 
  50.       Caption         =   "Exit"
  51.       Height          =   510
  52.       Left            =   2700
  53.       TabIndex        =   3
  54.       Top             =   1755
  55.       Width           =   1500
  56.    End
  57.    Begin TextBox Text1 
  58.       Height          =   2130
  59.       Left            =   675
  60.       MultiLine       =   -1  'True
  61.       TabIndex        =   2
  62.       Text            =   "Test your hotspot here by selecting text..."
  63.       Top             =   135
  64.       Width           =   1905
  65.    End
  66.    Begin CommandButton Command2 
  67.       Caption         =   "Restore Cursor"
  68.       Enabled         =   0   'False
  69.       Height          =   510
  70.       Left            =   2700
  71.       TabIndex        =   1
  72.       Top             =   675
  73.       Width           =   1500
  74.    End
  75.    Begin CommandButton Command1 
  76.       Caption         =   "Set Cursor"
  77.       Height          =   510
  78.       Left            =   2700
  79.       TabIndex        =   0
  80.       Top             =   135
  81.       Width           =   1500
  82.    End
  83. Option Explicit
  84. 'Old cursor handle
  85. Dim fOldCurHnd As Integer
  86. Sub Command1_Click ()
  87.     Dim CtrlHandle As Integer
  88.     'Retreive the handle of the control where the cursor will change
  89.     CtrlHandle = Form1.Text1.hWnd
  90.     'Set the cursor and return the old cursor handle for restore cursor
  91.     fOldCurHnd = SetCursor(CtrlHandle, Picture1, Picture2)
  92.     'Only modify button state for demo
  93.     Form1.Command1.Enabled = False
  94.     Form1.Command2.Enabled = True
  95.     Form1.Command4.Enabled = False
  96. End Sub
  97. Sub Command2_Click ()
  98.     Dim Handle As Integer
  99.     Handle = Form1.Text1.hWnd
  100.     Call RestoreCursor(Handle, fOldCurHnd)
  101.     'Only modify button state for demo
  102.     Form1.Command1.Enabled = True
  103.     Form1.Command2.Enabled = False
  104.     Form1.Command4.Enabled = True
  105. End Sub
  106. Sub Command4_Click ()
  107.    End
  108. End Sub
  109.